{% extends 'base.html' %}
{% block index %}
    {% load static %}
    <link href="{% static '/wangeditor/style.css' %}" rel="stylesheet">
    <script src="{% static '/wangeditor/index.js' %}"></script>

    <style>
        #editor—wrapper {
            border: 1px solid #ccc;
            z-index: 100; /* 按需定义 */
        }

        #toolbar-container {
            border-bottom: 1px solid #ccc;
        }

        #editor-container {
            height: 500px;
        }

        #side-menus {
            width: 20%;
        }

        #main-panel {
            position: absolute;
            left: 20%;
        {#width: 75%;#} height: 100%;
            padding-left: 10px;
            padding-top: 20px;
            float: left;
        }
        img{
            max-width: 600px;

        }
    </style>

    <div id="side-menus">
        {% if request.session.username %}
            <ul class="layui-nav layui-nav-tree layui-nav-side">

                <li class="layui-nav-item">
                    <a><img src="//t.cn/RCzsdCq" class="layui-nav-img">{{ request.session.username }}</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/user/notes">我的笔记</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/user/logout">退出登录</a>
                </li>
            </ul>
        {% elif request.COOKIES.username %}
            <ul class="layui-nav layui-nav-tree layui-nav-side">
                <li class="layui-nav-item">
                    <a><img src="//t.cn/RCzsdCq" class="layui-nav-img">{{ request.COOKIES.username }}</a>
                </li>
                <li class="layui-nav-item">
                    <a href="">我的笔记</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/user/logout">退出登录</a>
                </li>
            </ul>
        {% else %}
            <div class="layui-btn layui-btn-normal" onclick="toLogin()">
                登录
            </div>
            <div class="layui-btn" id="btn-reg" onclick="toReg()">
                注册
            </div>

        {% endif %}
    </div>
    <div id="main-panel">
        {% block add_note %}
        {% endblock %}

        {% block list_notes %}
        {% endblock %}

        {% block update_note %}
        {% endblock %}

        {% block detail %}
        {% endblock %}
    </div>

    <script>
        const toLogin = () => {
            window.location.href = '/user/login';
        }
        const toReg = () => {
            window.location.href = '/user/reg';
        }

    </script>

{% endblock %}


